<!DOCTYPE html>
<html lang="zh-CN">
<head>
<!-- 页面点击心形 -->
<script type="text/javascript" src="/js/clicklove.js"></script>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.0.2">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/tubiao.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/tubiao.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
  <link rel="stylesheet" href="/lib/pace/pace-theme-pace-theme-corner-indicator.min.css">
  <script src="/lib/pace/pace.min.js"></script>

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"yoursite.com","root":"/","scheme":"Pisces","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":"ture","show_result":false,"style":"mac"},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="前言什么是Hexo Blog Hexo 是一个快速、简洁且高效的博客框架，基于 Node.js 开发。Hexo 使用 Markdown 解析文章，并生成静态页面，非常便于静态部署和加载">
<meta property="og:type" content="article">
<meta property="og:title" content="hexo搭建">
<meta property="og:url" content="http://yoursite.com/2020/08/21/hexo/index.html">
<meta property="og:site_name" content="Hexo Blog">
<meta property="og:description" content="前言什么是Hexo Blog Hexo 是一个快速、简洁且高效的博客框架，基于 Node.js 开发。Hexo 使用 Markdown 解析文章，并生成静态页面，非常便于静态部署和加载">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://wx1.sbimg.cn/2020/08/21/3OjmY.png">
<meta property="og:image" content="https://wx2.sbimg.cn/2020/08/21/3OugA.png">
<meta property="og:image" content="https://wx1.sbimg.cn/2020/08/21/3O8OI.png">
<meta property="og:image" content="https://wx2.sbimg.cn/2020/08/21/3ONPK.png">
<meta property="og:image" content="https://wx2.sbimg.cn/2020/08/21/3Ol8T.png">
<meta property="og:image" content="https://wx2.sbimg.cn/2020/08/22/3Sesw.png">
<meta property="og:image" content="https://wx2.sbimg.cn/2020/08/22/3SHK2.png">
<meta property="og:image" content="https://wx1.sbimg.cn/2020/08/22/3SZem.png">
<meta property="og:image" content="https://wx2.sbimg.cn/2020/08/22/3Sr3O.png">
<meta property="og:image" content="https://wx1.sbimg.cn/2020/08/22/3T4Rh.png">
<meta property="og:image" content="https://wx2.sbimg.cn/2020/08/22/3T22G.png">
<meta property="og:image" content="https://wx1.sbimg.cn/2020/08/22/3TCJT.png">
<meta property="og:image" content="https://wx1.sbimg.cn/2020/08/22/3T9V2.png">
<meta property="og:image" content="https://wx1.sbimg.cn/2020/08/22/3TAtJ.png">
<meta property="article:published_time" content="2020-08-21T05:47:23.000Z">
<meta property="article:modified_time" content="2020-08-22T09:45:03.000Z">
<meta property="article:author" content="Serein">
<meta property="article:tag" content="hexo">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://wx1.sbimg.cn/2020/08/21/3OjmY.png">

<link rel="canonical" href="http://yoursite.com/2020/08/21/hexo/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>hexo搭建 | Hexo Blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

<link rel="stylesheet" href="/css/prism-tomorrow.css" type="text/css"></head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Hexo Blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

  <a href="https://github.com/yjc-2004" class="github-corner" title="Follow me on GayHub" aria-label="Follow me on GayHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2020/08/21/hexo/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/tx.jpg">
      <meta itemprop="name" content="Serein">
      <meta itemprop="description" content="热爱可抵岁月漫长">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Hexo Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          hexo搭建
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-08-21 13:47:23" itemprop="dateCreated datePublished" datetime="2020-08-21T13:47:23+08:00">2020-08-21</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-08-22 17:45:03" itemprop="dateModified" datetime="2020-08-22T17:45:03+08:00">2020-08-22</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/hexo/" itemprop="url" rel="index"><span itemprop="name">hexo</span></a>
                </span>
                  ，
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/hexo/hexo%E6%90%AD%E5%BB%BA/" itemprop="url" rel="index"><span itemprop="name">hexo搭建</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span><br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>1.9k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>2 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><h2 id="什么是Hexo-Blog"><a href="#什么是Hexo-Blog" class="headerlink" title="什么是Hexo Blog"></a>什么是Hexo Blog</h2><ul>
<li>Hexo 是一个快速、简洁且高效的博客框架，基于 Node.js 开发。Hexo 使用 Markdown 解析文章，并生成静态页面，非常便于静态部署和加载<a id="more"></a>
<h2 id="关于此Blog"><a href="#关于此Blog" class="headerlink" title="关于此Blog"></a>关于此Blog</h2></li>
<li>Blog搭建在树莓派3B上，系统为树莓派爱好者基地64位系统2.0</li>
<li>Blog部署在Gitee及GayHub上</li>
</ul>
<h1 id="搭建过程"><a href="#搭建过程" class="headerlink" title="搭建过程"></a>搭建过程</h1><h2 id="安装依赖"><a href="#安装依赖" class="headerlink" title="安装依赖"></a>安装依赖</h2><ul>
<li>更新包管理器<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="PGSQL"><figure class="iseeu highlight /pgsql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-<span class="keyword">get</span> <span class="keyword">update</span></span><br></pre></td></tr></table></figure></div></li>
<li>安装Git<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="ROUTEROS"><figure class="iseeu highlight /routeros"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-<span class="builtin-name">get</span> install git-core</span><br></pre></td></tr></table></figure></div></li>
<li>安装Node.js<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="CMAKE"><figure class="iseeu highlight /cmake"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt <span class="keyword">install</span> nodejs</span><br></pre></td></tr></table></figure></div></li>
<li>分别检查git和nodejs版本  <div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="PROPERTIES"><figure class="iseeu highlight /properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">git</span> <span class="string">--version</span></span><br><span class="line"><span class="attr">nodejs</span> <span class="string">-v </span></span><br></pre></td></tr></table></figure></div>
<blockquote>
<p><img src="https://wx1.sbimg.cn/2020/08/21/3OjmY.png"></p>
</blockquote>
</li>
</ul>
<h2 id="搭建本地Hexo"><a href="#搭建本地Hexo" class="headerlink" title="搭建本地Hexo"></a>搭建本地Hexo</h2><ul>
<li>由于国内网速原因，npm默认源经常安装失败，这里替换为国内淘宝镜像源（每十分钟同步一次）<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="AWK"><figure class="iseeu highlight /awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo npm install -g cnpm --registry=https:<span class="regexp">//</span>registry.npm.taobao.org</span><br></pre></td></tr></table></figure></div></li>
<li>全局安装Hexo博客框架<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="AVRASM"><figure class="iseeu highlight /avrasm"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo cnpm inastall -g hexo-<span class="keyword">cli</span></span><br></pre></td></tr></table></figure></div></li>
<li>检查是否安装成功<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="EBNF"><figure class="iseeu highlight /ebnf"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">hexo -v</span></span><br></pre></td></tr></table></figure></div>
<img src="https://wx2.sbimg.cn/2020/08/21/3OugA.png" alt="hexo基于nodejs"></li>
<li>新建博客文件夹<code>blog</code>并进入此文件夹，此文件夹包括博客所有文件，如果后面搭建错误，删掉此文件夹重来<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="DOS"><figure class="iseeu highlight /dos"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo <span class="built_in">mkdir</span> blog</span><br><span class="line"><span class="built_in">cd</span> blog </span><br></pre></td></tr></table></figure></div></li>
<li>初始化博客<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="EBNF"><figure class="iseeu highlight /ebnf"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">sudo hexo init</span></span><br></pre></td></tr></table></figure></div></li>
<li>经过上一步，博客已在本地搭建起来，可以启动本地4000端口预览，本地预览网址为<code>http://localhost:4000</code>或<code>http://本地IP地址:4000</code><div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="EBNF"><figure class="iseeu highlight /ebnf"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">sudo hexo s</span></span><br></pre></td></tr></table></figure></div>

</li>
</ul>
<p><img src="https://wx1.sbimg.cn/2020/08/21/3O8OI.png"><br><img src="https://wx2.sbimg.cn/2020/08/21/3ONPK.png"></p>
<ul>
<li>回到命令行按住Ctrl+C退出，博客文章均以.md格式（使用markdown语法）保存在<code>blog/source/_posts</code>，我们可以在此目录下删除或添加文章（直接添加或<code>sudo hexo new &quot;文章名&quot;</code>）</li>
</ul>
<p><img src="https://wx2.sbimg.cn/2020/08/21/3Ol8T.png"></p>
<ul>
<li><p>至此，基于hexo的本地blog已搭建完成</p>
<h2 id="推送远端"><a href="#推送远端" class="headerlink" title="推送远端"></a>推送远端</h2></li>
<li><p>博客毕竟是给别人看的，所以必须要满足公网访问，像Hexo这样的静态博客可以用pages服务推送到<del>GayHub</del><code>GitHub或Gitee</code>上的</p>
</li>
<li><p>首先你得有个Gitee（码云）或GitHub的账号</p>
<h3 id="GitHub方案"><a href="#GitHub方案" class="headerlink" title="GitHub方案"></a>GitHub方案</h3><h4 id="https"><a href="#https" class="headerlink" title="https"></a>https</h4></li>
<li><p>修改git用户名(密码暂时不用)</p>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="ROUTEROS"><figure class="iseeu highlight /routeros"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo git<span class="built_in"> config </span>--global user.name <span class="string">&quot;GitHub用户名&quot;</span></span><br><span class="line">sudo git<span class="built_in"> config </span>--global user.email <span class="string">&quot;GitHub邮箱&quot;</span></span><br></pre></td></tr></table></figure></div></li>
<li><p>检查用户名</p>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="ROUTEROS"><figure class="iseeu highlight /routeros"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo git<span class="built_in"> config </span>--list</span><br></pre></td></tr></table></figure></div></li>
<li><p>新建个GitHub仓库，命名规则为<br>-GItHub：<code>你的账号名,github.io</code>(必须)</p>
</li>
<li><p>在blog目录下安装git部署插件</p>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="SQL"><figure class="iseeu highlight /sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo cnpm <span class="keyword">install</span> <span class="comment">--save hexo-deployer-git</span></span><br></pre></td></tr></table></figure></div>
<p><img src="https://wx2.sbimg.cn/2020/08/22/3Sesw.png"></p>
</li>
<li><p>配置blog根目录下的<code>_config.yml</code>文件,注意冒号后面有空格</p>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="AVRASM"><figure class="iseeu highlight /avrasm"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="symbol">deploy:</span></span><br><span class="line"><span class="symbol">type:</span> git</span><br><span class="line"><span class="symbol">repo:</span> 刚刚建的仓库的https链接</span><br><span class="line"><span class="symbol">branch:</span> master</span><br></pre></td></tr></table></figure></div>
<p><img src="https://wx2.sbimg.cn/2020/08/22/3SHK2.png"></p>
</li>
<li><p>把本地blog推送到远端，期间要输入密码（linux密码不显示）</p>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="EBNF"><figure class="iseeu highlight /ebnf"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">sudo hexo d</span></span><br></pre></td></tr></table></figure></div></li>
<li><p>此时可以访问<code>你的GitHub用户名.github.io</code></p>
<h4 id="ssh"><a href="#ssh" class="headerlink" title="ssh"></a>ssh</h4></li>
<li><p>使用ssh连接可以免密推送blog到远端</p>
</li>
<li><p>进入ssh目录并生成密钥,使用默认文件夹一路回车。期间会提示输入密码，如果不想输，可以回车跳过</p>
<figure class="highlight jboss-cli"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">cd</span> ~<span class="string">/.ssh</span></span><br><span class="line">sudo ssh-keygen -t rsa -C <span class="string">&quot;用户邮箱&quot;</span></span><br></pre></td></tr></table></figure>
<p><img src="https://wx1.sbimg.cn/2020/08/22/3SZem.png"></p>
</li>
<li><p>如果上一步成功<code>.ssh</code>文件夹里应有<code>id_rsa与id_rsa.pub</code>两个文件,第一个为私钥文件(不要泄露)，第二个为公钥文件，用来验证身份，想了解的左转谷哥度娘<code>非对称加密</code></p>
</li>
<li><p>打开’id_rsa.pub’</p>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="CSS"><figure class="iseeu highlight /css"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">sudo</span> <span class="selector-tag">cat</span> <span class="selector-tag">id_rsa</span><span class="selector-class">.pub</span></span><br></pre></td></tr></table></figure></div>
<p><img src="https://wx2.sbimg.cn/2020/08/22/3Sr3O.png"></p>
</li>
<li><p>复制显示的一大串字符串</p>
</li>
<li><p>进入GitHub——右上角Settings——SSH and GPG keys——New SSH key——填入名称以及刚刚复制的字符串<br><img src="https://wx1.sbimg.cn/2020/08/22/3T4Rh.png"><br><img src="https://wx2.sbimg.cn/2020/08/22/3T22G.png"><br><img src="https://wx1.sbimg.cn/2020/08/22/3TCJT.png"></p>
</li>
<li><p>此时GitHub端已配置好</p>
</li>
<li><p>配置hexo根目录下<code>_config.yml</code>文件,找到deploy关键字，做如下修改，注意有空格，图片是同时部署在GitHub和Gitee上(ssh链接没有的点右上角<code>use ssh</code>)</p>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="DTS"><figure class="iseeu highlight /dts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="symbol">deploy:</span></span><br><span class="line"><span class="symbol">  type:</span> git</span><br><span class="line"><span class="symbol">  repo:</span> </span><br><span class="line"><span class="symbol">        github:</span> 你的仓库ssh链接</span><br><span class="line"><span class="symbol">  branch:</span> master</span><br></pre></td></tr></table></figure></div>
<p><img src="https://wx1.sbimg.cn/2020/08/22/3T9V2.png"><br><img src="https://wx1.sbimg.cn/2020/08/22/3TAtJ.png"></p>
</li>
<li><p>部署已基本完成,用下列命令推送到GitHub上</p>
<div class="highlight-wrap"autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true"data-rel="EBNF"><figure class="iseeu highlight /ebnf"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">sudo hexo d</span></span><br></pre></td></tr></table></figure></div></li>
<li><p>此时可以访问你的GitHub用户名.github.io</p>
</li>
<li><p>此篇文章是作者搭建好后靠回忆写的，可能会有n多BUG，欢迎指正</p>
</li>
</ul>
<h2 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h2><ul>
<li><a target="_blank" rel="noopener" href="https://www.runoob.com/markdown/md-tutorial.html">Markdown语法</a></li>
<li><a target="_blank" rel="noopener" href="https://oliverqueen.cn/2018/01/25/%E5%8F%AF%E8%83%BD%E6%98%AF%E6%9C%80%E5%85%A8%E7%9A%84%E4%BD%BF%E7%94%A8HEXO%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2%E6%95%99%E7%A8%8B/">hexo博客搭建</a></li>
<li><a target="_blank" rel="noopener" href="https://www.jianshu.com/p/852c3eeb5377">hexo搭建-简书</a></li>
<li><a target="_blank" rel="noopener" href="https://www.bilibili.com/video/BV1Yb411a7ty?from=search&seid=12334570058587441994">hexo搭建视频-哔哩哔哩</a></li>
</ul>

    </div>

    
    
    

    
        <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文就这样被你读完了<i class="fa fa-paw"></i>感谢阅读-------------</div>
    
</div>
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/hexo/" rel="tag"># hexo</a>
          </div>

        


        
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%89%8D%E8%A8%80"><span class="nav-number">1.</span> <span class="nav-text">前言</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BB%80%E4%B9%88%E6%98%AFHexo-Blog"><span class="nav-number">1.1.</span> <span class="nav-text">什么是Hexo Blog</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%85%B3%E4%BA%8E%E6%AD%A4Blog"><span class="nav-number">1.2.</span> <span class="nav-text">关于此Blog</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E6%90%AD%E5%BB%BA%E8%BF%87%E7%A8%8B"><span class="nav-number">2.</span> <span class="nav-text">搭建过程</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AE%89%E8%A3%85%E4%BE%9D%E8%B5%96"><span class="nav-number">2.1.</span> <span class="nav-text">安装依赖</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%90%AD%E5%BB%BA%E6%9C%AC%E5%9C%B0Hexo"><span class="nav-number">2.2.</span> <span class="nav-text">搭建本地Hexo</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%8E%A8%E9%80%81%E8%BF%9C%E7%AB%AF"><span class="nav-number">2.3.</span> <span class="nav-text">推送远端</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#GitHub%E6%96%B9%E6%A1%88"><span class="nav-number">2.3.1.</span> <span class="nav-text">GitHub方案</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#https"><span class="nav-number">2.3.1.1.</span> <span class="nav-text">https</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#ssh"><span class="nav-number">2.3.1.2.</span> <span class="nav-text">ssh</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%8F%82%E8%80%83"><span class="nav-number">2.4.</span> <span class="nav-text">参考</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Serein"
      src="/images/tx.jpg">
  <p class="site-author-name" itemprop="name">Serein</p>
  <div class="site-description" itemprop="description">热爱可抵岁月漫长</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">1</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">2</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">1</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/yjc-2004" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;yjc-2004" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:3128841173@qq.com" title="E-Mail → mailto:3128841173@qq.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Serein</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-area"></i>
    </span>
    <span title="站点总字数">2k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">2 分钟</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> 强力驱动
  </div><script color="0,0,255" opacity="0.5" zIndex="-1" count="200" src="https://cdn.jsdelivr.net/npm/canvas-nest.js@1/dist/canvas-nest.js"></script>
<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>


<div>
<span id="timeDate">载入天数...</span><span id="times">载入时分秒...</span>
<script>
    var now = new Date();
    function createtime() {
        var grt= new Date("09/21/2019 00:00:00");
        now.setTime(now.getTime()+250);
        days = (now - grt ) / 1000 / 60 / 60 / 24; dnum = Math.floor(days);
        hours = (now - grt ) / 1000 / 60 / 60 - (24 * dnum); hnum = Math.floor(hours);
        if(String(hnum).length ==1 ){hnum = "0" + hnum;} minutes = (now - grt ) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum);
        mnum = Math.floor(minutes); if(String(mnum).length ==1 ){mnum = "0" + mnum;}
        seconds = (now - grt ) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
        snum = Math.round(seconds); if(String(snum).length ==1 ){snum = "0" + snum;}
        document.getElementById("timeDate").innerHTML = "本站已安全运行 "+dnum+" 天 ";
        document.getElementById("times").innerHTML = hnum + " 小时 " + mnum + " 分 " + snum + " 秒";
    }
setInterval("createtime()",250);
</script>
</div>
        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>


  <script defer src="/lib/three/three.min.js"></script>
    <script defer src="/lib/three/three-waves.min.js"></script>


  















  

  

<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/live2dw/assets/shizuku.model.json"},"display":{"position":"right","width":150,"height":300},"mobile":{"show":true},"react":{"opacity":1},"log":false});</script></body>
</html>
